using System;
using System.IO;

namespace Mistral.SecureDrive
{
	public class FileDates
	{
		private string _fileName;
		private DateTime _lastAccessTime;
		private DateTime _creationTime;
		private DateTime _lastWriteTime;

		public FileDates( string fileName )
		{
			_fileName = fileName;
			FileInfo fileInfo = new FileInfo( _fileName );
			if( fileInfo.Exists )
			{
				_lastAccessTime = fileInfo.LastAccessTime;
				_creationTime = fileInfo.CreationTime;
				_lastWriteTime = fileInfo.LastWriteTime;				
			}

		}

		public void RestoreDates()
		{
			FileInfo fileInfo = new FileInfo( _fileName );
			if( fileInfo.Exists )
			{
				fileInfo.LastAccessTime = _lastAccessTime;
				fileInfo.CreationTime = _creationTime;
				fileInfo.LastWriteTime = _lastWriteTime;					
			}
			
		}
	}
}